﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.IO;
using PalFramework.Manager;

namespace PalBattleEmulator.Manager.Resource
{
    public class MultiFrameImageManager : FrameImageManager
    {
        public MultiFrameImageManager(string directory, string fileFormat, bool preload) : base(directory, fileFormat, preload)
        {
        }


        public ImageSource GetImage(string id, int frame)
        {
            string key = getKey(id, frame);
            if (images.ContainsKey(key))
                return images[key];
            return loadImage(key);
        }

        private string getKey(string id, int frame)
        {
            return String.Format("{0}_{1}", id, frame);
        }
    }
}
